//
//  IGCommonApi.m
//  jingdongfang
//
//  Created by BOE on 2017/9/11.
//  Copyright © 2017年 LJL. All rights reserved.
//

#import "IGCommonApi.h"

@implementation IGCommonApi

- (instancetype)initWithApiType:(IGiGalleryApiType)apiType
{
    self = [super init];
    if (self) {
        _apiType = apiType;
    }
    return self;
}

- (YTKRequestMethod)requestMethod {
    return YTKRequestMethodPOST;
}
    
- (NSString *)requestUrl {
    return [self customRequestUrl];
}
    
- (id)requestArgument {
    return [self customRequestArgument];
}
    
- (BOOL)isNeedHub {
    return NO;
}
    
- (NSString *)customRequestUrl {
    switch (self.apiType) {
        case IGiGalleryApiTypeMemberGetPhoneSMS:
            return @"member/getPhoneSMS";
        break;
            
        case IGiGalleryApiTypeMemberFindPwdGetPhoneSMS:
            return @"member/getPasswordPhoneSMS";
        break;
        
        case IGiGalleryApiTypeMemberGetPhoneSMSNew:
            return @"member/getPhoneSMSNew";
            break;
            
        case IGiGalleryApiTypeMemberFindPwdGetPhoneSMSNew:
            return @"member/getPasswordPhoneSMSNew";
            break;
        case IGiGalleryApiTypeCircleFocusCircle:
            return @"circle/focusCircle";
        break;
        
        case IGiGalleryApiTypeCircleTopicLike:
            return @"circle/topic/likeTopic";
        break;
        
        case IGiGalleryApiTypeCircleTopicDel:
            return @"circle/topic/deleteTopicV2";
        break;
        
        case IGiGalleryApiTypeSetDeafultAddress:
            return @"works/address!setDefaultAddress.action";
        break;
        
        case IGiGalleryApiTypeDelAdress:
            return @"works/address!deleteAddress.action";
        break;
            
        case IGiGalleryApiTypeDelBundingMsg:
            return @"equ/delBundingMsg";
        break;
            
        
        default:
        break;
    }
}
    
- (id)customRequestArgument {
    switch (self.apiType) {
        case IGiGalleryApiTypeMemberGetPhoneSMS:
            return @{
                     @"phone":self.phone,
                     @"imageCode":self.code
                     };
        break;
            
        case IGiGalleryApiTypeMemberFindPwdGetPhoneSMS:
            return @{
                     @"phone":self.phone,
                     @"imageCode":self.code
                     };
        break;
        case IGiGalleryApiTypeMemberGetPhoneSMSNew:
            return @{
                     @"phone":self.phone,
                     @"imageCode":self.code
                     };
            break;
            
        case IGiGalleryApiTypeMemberFindPwdGetPhoneSMSNew:
            return @{
                     @"phone":self.phone,
                     @"imageCode":self.code
                     };
            break;
            
        case IGiGalleryApiTypeCircleFocusCircle:
            return @{
                     @"circleId":self.circleId,
                     @"uid":[IGUser getUid]
                     };
        break;
        
        case IGiGalleryApiTypeCircleTopicLike:
            return @{
                     @"topicId":self.topicId,
                     @"uid":[IGUser getUid]
                     };
        break;
        
        case IGiGalleryApiTypeCircleTopicDel:
            return @{
                     @"topicId":self.topicId,
                     @"uid":[IGUser getUid]
                     };
        break;
        
        case IGiGalleryApiTypeSetDeafultAddress:
            return @{
                     @"addressId":self.addressId,
                     @"uId":[IGUser getUid]
                     };
        break;
        
        case IGiGalleryApiTypeDelAdress:
            return @{
                     @"addressId":self.addressId,
                     @"uId":[IGUser getUid]
                     };
        break;
        
        case IGiGalleryApiTypeDelBundingMsg:
            return @{
                     @"id":self.bid,
                     @"uId":[IGUser getUid]
                     };
        break;
            
        default:
        break;
    }
}

@end

@implementation IGCommonModel : IGBaseModel

+ (BOOL)propertyIsOptional:(NSString *)propertyName {
    return YES;
}
    
@end

@implementation IGCommonResp : IGBaseResp

+ (BOOL)propertyIsOptional:(NSString *)propertyName {
    return YES;
}
    
@end
